import '../tooltip.dart';
import 'series.dart';

import 'package:json_annotation/json_annotation.dart';

part 'pie_series.g.dart';

@JsonSerializable(includeIfNull: false, explicitToJson: true)
class PieEmphasis {
  var scale;
  var scaleSize;
  var focus;
  var blurScope;
  SeriesLabel? label;
  LabelLine? labelLine;
  SeriesItemStyle? itemStyle;

  PieEmphasis(
      {this.scale,
      this.scaleSize,
      this.focus,
      this.blurScope,
      this.label,
      this.labelLine,
      this.itemStyle});

  factory PieEmphasis.fromJson(Map<String, dynamic> json) =>
      _$PieEmphasisFromJson(json);

  Map<String, dynamic> toJson() => _$PieEmphasisToJson(this);
}

@JsonSerializable(includeIfNull: false, explicitToJson: true)
class PieBlurSelectEmphasis {
  SeriesLabel? label;
  LabelLine? labelLine;
  SeriesItemStyle? itemStyle;

  PieBlurSelectEmphasis({this.label, this.labelLine, this.itemStyle});

  factory PieBlurSelectEmphasis.fromJson(Map<String, dynamic> json) =>
      _$PieBlurSelectEmphasisFromJson(json);

  Map<String, dynamic> toJson() => _$PieBlurSelectEmphasisToJson(this);
}

@JsonSerializable(includeIfNull: false, explicitToJson: true)
class PieData {
  var name;
  var value;
  var selected;
  SeriesLabel? label;
  LabelLine? labelLine;
  SeriesItemStyle? itemStyle;
  PieBlurSelectEmphasis? emphasis;
  PieBlurSelectEmphasis? blur;
  PieBlurSelectEmphasis? select;
  Tooltip? tooltip;

  PieData(
      {this.name,
      this.value,
      this.selected,
      this.label,
      this.labelLine,
      this.itemStyle,
      this.emphasis,
      this.blur,
      this.select,
      this.tooltip});

  factory PieData.fromJson(Map<String, dynamic> json) =>
      _$PieDataFromJson(json);

  Map<String, dynamic> toJson() => _$PieDataToJson(this);
}

@JsonSerializable(includeIfNull: false, explicitToJson: true)
class PieSeries extends Series {
  var id;
  var type = 'pie';
  var name;
  var legendHoverLink;
  var selectedMode;
  var selectedOffset;
  var clockwise;
  var startAngle;
  var minAngle;
  var minShowLabelAngle;
  var roseType;
  var avoidLabelOverlap;
  var stillShowZeroSum;
  var cursor;
  var zlvel;
  var z;
  var left;
  var top;
  var right;
  var bottom;
  var width;
  var height;
  SeriesLabel? label;
  LabelLine? labelLine;
  LabelLayout? labelLayout;
  SeriesItemStyle? itemStyle;
  PieEmphasis? emphasis;
  PieBlurSelectEmphasis? blur;
  PieBlurSelectEmphasis? select;
  var center;
  var radius;
  var seriesLayoutBy;
  var datasetIndex;
  var dimensions;
  var encode;
  List<PieData>? data;

  MarkPoint? markPoint;
  MarkLine? markLine;
  MarkArea? markArea;

  var silent;
  var animationType;
  var animationTypeUpdate;

  var animation;
  var animationThreshold;
  var animationDuration;
  var animationEasing;
  var animationDelay;
  var animationDurationUpdate;
  var animationEasingUpdate;
  var animationDelayUpdate;

  Tooltip? tooltip;

  PieSeries(
      {this.id,
      this.name,
      this.legendHoverLink,
      this.selectedMode,
      this.selectedOffset,
      this.clockwise,
      this.startAngle,
      this.minAngle,
      this.minShowLabelAngle,
      this.roseType,
      this.avoidLabelOverlap,
      this.stillShowZeroSum,
      this.cursor,
      this.zlvel,
      this.z,
      this.left,
      this.top,
      this.right,
      this.bottom,
      this.width,
      this.height,
      this.label,
      this.labelLine,
      this.labelLayout,
      this.itemStyle,
      this.emphasis,
      this.blur,
      this.select,
      this.center,
      this.radius,
      this.seriesLayoutBy,
      this.datasetIndex,
      this.dimensions,
      this.encode,
      this.data,
      this.markPoint,
      this.markLine,
      this.markArea,
      this.silent,
      this.animationType,
      this.animationTypeUpdate,
      this.animation,
      this.animationThreshold,
      this.animationDuration,
      this.animationEasing,
      this.animationDelay,
      this.animationDurationUpdate,
      this.animationEasingUpdate,
      this.animationDelayUpdate,
      this.tooltip});

  factory PieSeries.fromJson(Map<String, dynamic> json) =>
      _$PieSeriesFromJson(json);

  Map<String, dynamic> toJson() => _$PieSeriesToJson(this);
}
